﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Geometry x:Key="CheckMarkGeometry">F1 M 3.674316,8.115234 L 0.000000,4.441406 L 1.269043,3.171875 L 3.674316,5.578125 L 9.252441,0.000000 L 10.521484,1.269531 L 3.674316,8.115234 Z</Geometry>
    <GeometryDrawing x:Key="CheckMarkDrawing" Brush="#3c3c3c" Geometry="{StaticResource CheckMarkGeometry}" />
    
    <Style TargetType="CheckBox">
        <Setter Property="BorderBrush" Value="{DynamicResource DefaultBorderBrush}" />
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="Background" Value="{DynamicResource DefaultBackgroundBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="CheckBox">
                    <StackPanel Orientation="Horizontal">
                        <Grid>
                            <Border x:Name="border" Width="16" Height="16" CornerRadius="3" BorderThickness="1" BorderBrush="{TemplateBinding BorderBrush}"
                            Background="{TemplateBinding Background}"/>
                            <Image x:Name="checkMark" Visibility="Collapsed" Stretch="None" VerticalAlignment="Center" HorizontalAlignment="Center" Width="12" Height="12">
                                <Image.Source>
                                    <DrawingImage Drawing="{StaticResource CheckMarkDrawing}" />
                                </Image.Source>
                            </Image>
                        </Grid>
                        <TextBlock Foreground="{DynamicResource DefaultForegroundBrush}" Text="{TemplateBinding Content}" Margin="8,0,0,0" />
                    </StackPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter Property="Visibility" TargetName="checkMark" Value="Visible" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Background" TargetName="border" Value="{DynamicResource LightBackgroundBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>